﻿using System;
using System.Linq;
using System.Web.Security;
using FatFreeFitness._models;

namespace FatFreeFitness.membership
{
    public static class MembershipHelper
    {
        public static int GetMemberID()
        {
            var membershipKey = (Guid)Membership.GetUser().ProviderUserKey;

            using (var entities = new FatFreeFitnessEntities())
            {
                return entities.Members.Where(m => m.MembershipKey == membershipKey).First().ID;
            }
        }
    }
}